public class Binary {
    public static void main(String[] args) {
        System.out.println(toBin(-1));
    }

    private static String toBin(int oct) {
        StringBuilder sb = new StringBuilder();

        int t = oct;
        while (oct > 0) {
            t >>= 1;
            t <<= 1;
            sb.append(t ^ oct);
            oct = oct >> 1;
            t = oct;
        }
        if (sb.length() == 0) {
            sb.append(0);
        }
        return sb.reverse().toString();
    }
}
